package com.gupao.vip.bio;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

import org.apache.commons.lang3.StringUtils;

/**
 * 客户端：发送数据+接收数据
 * @author dell
 *
 */
public class Client {
	public static void main(String[] args) throws IOException {
		System.out.println("请输入姓名：");
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
		String name = bufferedReader.readLine();
		if(StringUtils.isEmpty(name)){
			return;
		}
		
		Socket client = new Socket(Constants.DEFAULT_IP, Constants.DEFAULT_PORT);

		//发送数据
		new Thread(new Send(client, name)).start();
		
		//结束服务器的响应数据
		new Thread(new Receive(client)).start();
	}
}
